package com.xzy.dao;

import com.xzy.entity.Tech;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component(value = "TechMapper")
public interface TechMapper {
    @Insert("insert into tech(techTitle,techContent,techType,isRepro,userId) values (#{techTitle},#{techContent},#{techType},#{isRepro},#{userId})")
    void addTech(Tech tech);

    @Select("select * from tech where techId=#{techId}")
    Tech getTech(int techId);

    @Select("select * from tech where techType like #{techType}")
    List<Tech> getTechByType(String techType);

    @Select("select * from tech")
     List<Tech> findAll();

    @Delete("delete from tech where techId=#{techId}")
    void deleteTech(int techId);

   @Update("update tech set techTitle=#{techTitle},techContent=#{techContent},techType=#{techType},isRepro=#{isRepro} where techId=#{techId}")
    void updateTech(Tech tech);
}
